package com.heyqing.topic.FindTheDifference_0389;

/**
 * ClassName:FindTheDifference
 * Package:com.heyqing.topic.FindTheDifference_0389
 * Description:
 *
 * @Date:2024/9/28
 * @Author:Heyqing
 */
public class FindTheDifference {
    public char findTheDifference(String s, String t) {
        int[] flag = new int[26];
        for (int i = 0; i < t.length(); i++) {
            flag[t.charAt(i) - 97]++;
            if (i >= s.length()) continue;
            flag[s.charAt(i) - 97]--;
        }
        for (int i = 0; i < 26; i++) {
            if (flag[i] == 1) return (char) (97 + i);
        }
        return 'a';
    }
}
